using System;
using System.IO;
using Mono.Unix;

namespace Paret
{

public class  PapersAboutDialog : Gtk.AboutDialog
{
		private static PapersAboutDialog about = null;
		
		private PapersAboutDialog () {
			Artists = new string [] {
				"Jordi Carrillo",	
			};
			Authors = new string [] {
				"Jordi Carrillo",
				"",
			};
			Comments = Catalog.GetString ("WallPaper Switcher for GNOME");
			Copyright = Catalog.GetString ("Copyright \x00a9 2009 Jordi Carrillo");
			Documenters = new string[] {
				"Jordi Carrillo"
			};
			//Read license from COPYING
			try {
				System.Reflection.Assembly assembly = System.Reflection.Assembly.GetCallingAssembly ();
				using (Stream s = assembly.GetManifestResourceStream("/home/jordilin/Projects/paret/Paret/bin/Release/COPYING")) {
					StreamReader reader = new StreamReader (s);
					License = reader.ReadToEnd ();
					s.Close ();
				}
			} catch (Exception e) {
				Console.WriteLine (e);
				License = "GPL v3";
			}
			//Logo = new Gdk.Pixbuf (System.Reflection.Assembly.GetEntryAssembly (), "f-spot-128.png");
			ProgramName = "Paret";
			TranslatorCredits = Catalog.GetString ("translator-credits");
                	if (System.String.Compare (TranslatorCredits, "translator-credits") == 0)
                		TranslatorCredits = null;
			
			Website = "http://www.launchpad.net/paret";
			WebsiteLabel = Catalog.GetString ("Paret Website");
			WrapLicense = true;
		}

		public static void ShowUp ()
		{
			if (about == null) {
				about = new PapersAboutDialog ();
				about.Destroyed += delegate (object o, EventArgs e) {about = null;};
				about.Response += delegate (object o, Gtk.ResponseArgs e) {if (about != null) about.Destroy ();};
			}
			about.Show ();
		}
	}
}
